package edu.hubu.book.domain;


import java.io.Serializable;

/**
 * 用于封装登录或注册时后端返回前端数据对象
 * 成功与否  及  错误信息
 */
public class UserResultInfo implements Serializable {
    private boolean flag;//后端返回结果正常为true，发生异常返回false
    private Object data;//后端返回结果数据对象
    private String errorMsg;//发生异常的错误消息

    //无参构造方法
    public UserResultInfo() {
    }

    public UserResultInfo(boolean flag) {
        this.flag = flag;
    }

    /**
     * 有参构造方法
     *
     * @param flag
     * @param errorMsg
     */
    public UserResultInfo(boolean flag, String errorMsg) {
        this.flag = flag;
        this.errorMsg = errorMsg;
    }

    /**
     * 有参构造方法
     *
     * @param flag
     * @param data
     * @param errorMsg
     */
    public UserResultInfo(boolean flag, Object data, String errorMsg) {
        this.flag = flag;
        this.data = data;
        this.errorMsg = errorMsg;
    }


    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    @Override
    public String toString() {
        return "ResultInfo{" + "flag=" + flag + ", data=" + data + ", errorMsg='" + errorMsg + '\'' + '}';
    }
}
